import request from '@/utils/request'

// 获取report列表的接口
export function getReport(params) {
  return request({
    url: `/online/flycare/admin/report`,
    method: 'GET',
    params: params
  })
}

//获取作废报告列表
export function getInvalidReport(params){
  return request({
    url:`/online/flycare/admin/report/invalid/list`,
    method:'GET',
    params:params
  })
}

// 修改report状态的接口
export function editReportState(reportId, status) {
  return request({
    url: `/online/flycare/admin/report/${reportId}/state/${status}`,
    method: 'POST'
  })
}

// 获取report详情的接口
export function getReportDetail(reportId) {
  return request({
    url: `/online/flycare/admin/report/detail/${reportId}`,
    method: 'GET'
  })
}

// 按月份获取report详情的接口
export function getReportByMonth(params) {
  return request({
    url: `/online/flycare/admin/report/get-by-month`,
    method: 'GET',
    params
  })
}

// 获取当前月份的report的历史记录的接口
export function getReportHis(params) {
  return request({
    url: `/online/flycare/admin/report/history`,
    method: 'GET',
    params: params
  })
}

// 重新生成report的接口
export function regenerateReport(data) {
  return request({
    url: `/online/flycare/admin/report/generate`,
    method: 'POST',
    data:data
  })
}

//下载报告明细文件的接口
export function downloadFile(params) {
  return request({
    url: `/online/flycare/admin/detail/file/download`,
    method: 'GET',
    params:params
  })
}
// 获取平台与合同之间关系
export function getContract(reportId){
  return request({
    url:`/online/flycare/admin/report/contract/plat/${reportId}`,
    method:'GET'
  })
}

//获取近6个月的report数据
export function getNearData(reportId,params){
  return request({
    url:`/online/flycare/admin/report/detail/month/data/${reportId}`,
    method:'GET',
    params:params
  })
}

//获取报告中提示信息
export function getTip(reportId){
  return request({
    url:`/online/flycare/admin/report/${reportId}/tip/list `,
    method:'GET'
  })
}

//获取重新生成失败的报告中日志信息
export function getLog(params){
  return request({
    url:`/online/flycare/admin/report/event`,
    method:'GET',
    params:params
  })
}

//修改日志信息
export function editLog(id,status,data){
  return request({
    url:`/online/flycare/admin/report/event/${id}/state/${status}/change `,
    method:'POST',
    data:data
  })
}
